<?php if(!defined('BASEPATH'))exit('No direct script access allowed'); ?>
<?php $this->load->view('admin/global/header'); ?>
<?php $this->load->view('admin/global/left'); ?>
<table cellpadding="0" cellspacing="0">
    <tr>
        <td class="title"><?php echo lang('LIST').': '.lang('NOTICE'); ?></td>
    </tr>
    <?php if(isset($denied)){ ?>
    <tr>
        <td class="bar">
            <div class="error"><?php echo lang('DENIED'); ?></div>
            <meta http-equiv="refresh" content="5; <?php echo base_url().ADMIN_PATH; ?>" />
        </td>
    </tr>
    <?php }else{ ?>
    <?php echo Modules::run('admin/bar_module/index', $buttons, $searchs, $filters); ?>
    <tr>
        <td valign="top">
        <form name="frmView" id="frmView" method="post">
            <table class="view" cellpadding="0" cellspacing="0">
                <tr class="title">
                    <td class="index">#</td>
                    <td width="20">
                        <input type="checkbox" name="checkAll" id="checkAll" value="0" />
                    </td>
                    <?php echo Modules::run('admin/sort_module/index', 'title', lang('TITLE')); ?>
                    <?php echo Modules::run('admin/sort_module/index', 'user', lang('NOTICER')); ?>
                    <td><?php echo lang('GROUP'); ?></td>
                    <?php echo Modules::run('admin/sort_module/index', 'level', lang('LEVEL_NOTICE'), 110); ?>
                    <?php echo Modules::run('admin/sort_module/index', 'home', lang('HOME'), 80); ?>
                    <?php echo Modules::run('admin/sort_module/index', 'status', lang('ACTIVE'), 80); ?>
                    <?php echo Modules::run('admin/sort_module/index', 'postDate', lang('POST_DATE'), 110); ?>
                    <?php echo Modules::run('admin/sort_module/index', 'expireDate', lang('EXPIRE_DATE'), 110); ?>
                    <?php echo Modules::run('admin/sort_module/index', 'id', lang('ID'), 50); ?>
                </tr>
                <!--LOOP-->
                <?php $index = 1; ?>
                <?php foreach($rows as $row){ ?>
                <tr class="<?php if($index%2 == 0){echo 'bgColor';} ?>">
                    <td class="index"><?php echo $sTT++; ?></td>
                    <td align="center">
                        <input type="checkbox" name="idRecord[]" id="idRecord<?php echo $index; ?>" class="idRecord" value="<?php echo $row->notID; ?>" />
                    </td>
                    <td>
                        <a href="<?php echo base_url().ADMIN_PATH; ?>notice/post/<?php echo $row->notID; ?>" title="<?php echo lang('EDIT'); ?>">
                            <?php echo $row->notTitle; ?>
                        </a>
                    </td>
                    <td>
                        <?php if((int)$row->useGroup < 4){ ?>
                        <?php if((int)$row->useGroup == 1){ ?>
                        <?php echo $row->useUsername; ?>
                        <?php }elseif((int)$row->useGroup == 2){ ?>
                        <span class="green"><b><?php echo $row->useUsername; ?></b></span>
                        <?php }else{ ?>
                        <span class="blue"><b><?php echo $row->useUsername; ?></b></span>
                        <?php } ?>
                        <img src="<?php echo base_url(); ?>templates/admin/images/expand.png" class="vtip" title="<?php echo tip(array(lang('FULLNAME')=>$row->useFullname, lang('EMAIL')=>$row->useEmail, lang('TEL')=>$row->usePhone, lang('YAHOO')=>$row->useYahoo)); ?>" align="absmiddle" />
                        <?php }elseif((int)$row->useGroup == 4){ ?>
                        <span class="red"><b><?php echo $row->useUsername; ?></b></span>
                        <?php }else{ ?>
                        <span class="orange"><b><?php echo $row->useUsername; ?></b></span>
                        <?php } ?>
                    </td>
                    <td align="center">
                        <?php if(trim(strtoupper($row->notGroup)) == 'ALL'){ ?>
                        <i><?php echo lang('GLOBAL_NOTICE'); ?></i>
                        <?php }else{ ?>
                        <?php $group = ''; ?>
                        <?php if(trim($row->notGroup) != '' && stristr($row->notGroup, '{(1)}')){ ?>
                        <?php $group .= '<span>'.lang('NORMAL').'</span>, '; ?>
                        <?php } ?>
                        <?php if(trim($row->notGroup) != '' && stristr($row->notGroup, '{(2)}')){ ?>
                        <?php $group .= '<span class="green"><b>'.lang('VIP').'</b></span>, '; ?>
                        <?php } ?>
                        <?php if(trim($row->notGroup) != '' && stristr($row->notGroup, '{(3)}')){ ?>
                        <?php $group .= '<span class="blue"><b>'.lang('BESTSHOP').'</b></span>'; ?>
                        <?php } ?>
                        <?php echo trim(trim($group), ','); ?>
                        <?php } ?>
                    </td>
                    <td align="center">
                        <?php if((int)$row->notLevel == 1){ ?>
                        <?php echo lang('NORMAL'); ?>
                        <?php }elseif((int)$row->notLevel == 2){ ?>
                        <span class="blue"><b><?php echo lang('IMPORTANT'); ?></b></span>
                        <?php }else{ ?>
                        <span class="red"><b><?php echo lang('EMERGENCY'); ?></b></span>
                        <?php } ?>
                    </td>
                    <td align="center">
                        <?php if((int)$row->notHome == 1){ ?>
                        <img src="<?php echo base_url(); ?>templates/admin/images/status1.png" onclick="eProc('UNHOME', 'idRecord<?php echo $index; ?>')" title="<?php echo lang('UNSHOW_HOME'); ?>" />
                        <?php }else{ ?>
                        <img src="<?php echo base_url(); ?>templates/admin/images/status0.png" onclick="eProc('HOME', 'idRecord<?php echo $index; ?>')" title="<?php echo lang('SHOW_HOME'); ?>" />
                        <?php } ?>
                    </td>
                    <td align="center">
                        <?php if((int)$row->notStatus == 1){ ?>
                        <img src="<?php echo base_url(); ?>templates/admin/images/status1.png" onclick="eProc('UNACTIVE', 'idRecord<?php echo $index; ?>')" title="<?php echo lang('UNACTIVE'); ?>" />
                        <?php }else{ ?>
                        <img src="<?php echo base_url(); ?>templates/admin/images/status0.png" onclick="eProc('ACTIVE', 'idRecord<?php echo $index; ?>')" title="<?php echo lang('ACTIVE'); ?>" />
                        <?php } ?>
                    </td>
                    <td align="center"><b><?php echo date_convert($row->notPostDate); ?></b></td>
                    <td align="center"><b><?php echo date_convert($row->notExpireDate); ?></b></td>
                    <td align="center"><?php echo $row->notID; ?></td>
                </tr>
                <?php $index++; ?>
                <?php } ?>
                <!--LOOP-->
                <?php echo Modules::run('admin/pagination_module/index', $total, 11); ?>
            </table>
            <input type="hidden" name="action" value="" />
            <input type="hidden" name="value" value="" />
        </form>
        </td>
    </tr>
    <?php } ?>
</table>
<?php $this->load->view('admin/global/right'); ?>
<?php $this->load->view('admin/global/footer'); ?>